package ru.braim.weather_app.dto.weather;

import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
import lombok.Setter;
import org.springframework.http.HttpStatus;
import ru.braim.weather_app.models.WeatherForecast;
import ru.braim.weather_app.models.enums.WeatherCondition;
import ru.braim.weather_app.responses.weather.WeatherResponse;

import java.time.LocalDateTime;
import java.util.List;

@Getter
@Setter
@JsonInclude(JsonInclude.Include.NON_NULL)
public class WeatherRequestDTO {

    private Long regionId;
    private Float temperature;
    private Float humidity;
    private Float windSpeed;
    private String weatherCondition;
    private Float precipitationAmount;
    private LocalDateTime measurementDateTime;
    private List<Long> weatherForecast;

    public boolean isValidWeatherRequest() {
        if (this.getRegionId() == null) {
            return false;
        }

        if (this.getRegionId() <= 0) {
            return false;
        }

        if (this.getWindSpeed() == null) {
            return false;
        }

        if (WeatherCondition.getWeatherCondition(this.getWeatherCondition()) == null) {
            return false;
        }

        if (this.getWindSpeed() < 0) {
            return false;
        }

        if (this.getPrecipitationAmount() == null) {
            return false;
        }

        if (this.getPrecipitationAmount() < 0) {
            return false;
        }

        return true;

    }

}
